libglnx porting: Port callers of gs_file_unlink to just unlink()
authorColin Walters <walters@verbum.org>
Sun, 29 May 2016 17:33:25 +0000 (13:33 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 30 May 2016 11:33:28 +0000 (11:33 +0000)
In the second case it's actually less code too.

Closes: #312
Approved by: giuseppe

src/libostree/ostree-repo.c
src/libotutil/ot-gio-utils.c

index f2538f5157cdd64a17f9ccd371679a57dfa8de27..1d0b2f9343dfa3c867d5c17679f13408e3ec76b5 100644 (file)
@@ -1255,8 +1255,11 @@ impl_repo_remote_delete (OstreeRepo     *self,
 
   if (remote->file != NULL)
     {
-      if (!gs_file_unlink (remote->file, cancellable, error))
-        goto out;
+      if (unlink (gs_file_get_path_cached (remote->file)) != 0)
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
     }
   else
     {
index 103f6edde9d98134ec6445539e35981b1668bec4..6541a3215385a3a7f4e1d17482ffc69b95537fa5 100644 (file)
@@ -390,25 +390,12 @@ ot_gfile_ensure_unlinked (GFile         *path,
                           GCancellable  *cancellable,
                           GError       **error)
 {
-  gboolean ret = FALSE;
-  GError *temp_error = NULL;
-
-  if (!gs_file_unlink (path, cancellable, &temp_error))
+  if (unlink (gs_file_get_path_cached (path)) != 0)
     {
-      if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
-        {
-          g_clear_error (&temp_error);
-        }
-      else
-        {
-          g_propagate_error (error, temp_error);
-          goto out;
-        }
+      if (errno != ENOENT)
+        return FALSE;
     }
-  
-  ret = TRUE;
- out:
-  return ret;
+  return TRUE;
 }
 
 /**